package com.spring.dao;

import com.nebula.core.entity.vo.Relation;
import com.spring.entity.GraphDo;
import com.spring.entity.PathDO;
import com.vesoft.nebula.client.graph.data.ResultSet;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * 查询路径接口
 *
 * @author DAIYI
 * @since 2021-09-10
 */
@Repository
public interface PathDao {

    /**
     * 查询两点之间的路径
     */
    List<Relation> selectPath(@Param("src") String src, @Param("dst") String dst);

    @Select("FIND ALL PATH WITH PROP FROM #{src} TO #{dst} OVER *  YIELD path AS p")
    Map selectPathMap(@Param("src") String src, @Param("dst") String dst);

    @Select("match (v1)-[r:serve]-(v2) return v1 as p,v2 as t")
    List<GraphDo> selectBatch();

}
